package com.ynhenc.pta.routeRank.impl;

import com.ynhenc.pta.routeRank.Node;
import com.ynhenc.pta.routeRank.Section;
import com.ynhenc.pta.routeRank.SectionList;
import com.ynhenc.pta.routeRank.TransitType;

public class DirectLinkSection extends ComLib_PTA {
	
	public SectionList getDirectSectionList(TransitType transitType, Node s, Node e) {
		SectionList sectionList = new SectionList();
		PathImpl path = new PathImpl();
		path.addVertex(s);
		path.addVertex(e);
		Section section = new SectionImpl(transitType, s, e, path);
		sectionList.add(section);
		
		// set distance meter of direct link
		if( s != null && e != null ) { 
			double dist_Meter = s.getDirectDistance_Meter(e);
			section.setLength_Meter( dist_Meter );
			double spd_MPS = transitType.getSpeedAverage_MeterPerSec();
			if( spd_MPS > 0 ) {
				double time_Sec = dist_Meter/spd_MPS;
				section.setTime_Sec(time_Sec);
			} 
		} else {
			this.debug( "start or end node is null!!!!!");
		} 
		// enf of setting distance meter of direct link
		
		return sectionList;
	}
	
}
